export default {
	//传入日期对象，返回年、月、日、星期几、时、分、秒
	getDateObj(date) {
		const year = date.getFullYear()
		const month = date.getMonth() + 1
		const day = date.getDate()
		const hour = date.getHours()
		const minute = date.getMinutes()
		const second = date.getSeconds()
		let week
		switch (date.getDay()) {
			case 0:
				week = "星期日"
				break
			case 1:
				week = "星期一"
				break
			case 2:
				week = "星期二"
				break
			case 3:
				week = "星期三"
				break
			case 4:
				week = "星期四"
				break
			case 5:
				week = "星期五"
				break
			case 6:
				week = "星期六"
				break
		}

		return {
			year,
			month: month < 10 ? `0${month}` : month,
			day: day < 10 ? `0${day}` : day,
			week,
			hour: hour < 10 ? `0${hour}` : hour,
			minute: minute < 10 ? `0${minute}` : minute,
			second: second < 10 ? `0${second}` : second,
		}
	}
}